#ifndef QVARIANT_UTILS_H
#define QVARIANT_UTILS_H

#include <QVariant>

template <typename T> class QVariantPtr {
 public:
  static T* asPointer(const QVariant& v) {
    return static_cast<T*>(v.value<void*>());
  }

  static QVariant asVariant(T* ptr) {
    return QVariant::fromValue<void*>(ptr);
  }
};

#endif // QVARIANT_UTILS_H
